extends "../calxJS_Hide/calxJS_Hide2.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "至高之眼"                   # 角色的名称
	attCoe.atkRan = 3                 # 攻击距离
	attCoe.maxHp = 5                  # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 7.5                   # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 3                 # 魔法攻击（每点代表13.7）
	attCoe.def = 4.5                    # 物理防御（每点代表15）
	attCoe.mgiDef = 4.5                 # 魔法防御（每点代表16.6）
	atkEff = "atk_dang" 
	xb = "光"
	lv = 4    
	addSkillTxt("[折射炮]发射折射炮攻击仇恨目标，造成120%光系物理伤害，叠加一层<耀光>\n若目标具有<耀光>则引爆并对随机敌方单位释放折射炮，一次释放只能触发一次连击[CD:7]")
	addSkillTxt("[闪光甲]进入闪光状态6秒，持续时间内提升20%伤害，此期间受到的攻击和技能有50%概率闪避\n受到攻击时，给予攻击者一层<耀光>[CD:14]")
	addSkillTxt("[光影]发射光影子弹攻击敌方单体，造成180%暗系物理伤害，减少目标物攻20%5秒，若目标具有<耀光>\n则引爆并削弱目标物防20%5秒[CD:10]")
	addSkillTxt("[color=#FFFF00][太阳黑子][/color]:[color=#FFCC22]化身太阳黑子发射耀眼的光线攻击敌方全体，造成240%光系物理伤害并引爆所有<耀光>\n附加1层新的<耀光>[CD:18][/color]")
	addCdSkill("zsp",7)
	addCdSkill("sgj",14)
	addCdSkill("gy",10)
	addCdSkill("tyhz",18)

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "zsp":
		var cha = utils.getRndEnemy(self)
		var buff:Buff = aiCha.hasBuff("yaoguang")
		var d:Eff = newEff("sk_feiDang",sprcPos)
		d._initFlyCha(aiCha)
		yield(d,"onReach")
		typeHurtCha(aiCha,att.atk*1.2,Chara.HurtType.PHY,Chara.AtkType.SKILL)
		if buff !=null:
			typeHurtCha(aiCha,att.atk*0.5,Chara.HurtType.REAL,Chara.AtkType.EFF)
			buff.isDel = true
			var b:Eff = newEff("sk_feiDang",sprcPos)
			b._initFlyCha(cha)
			yield(b,"onReach")
			typeHurtCha(cha,att.atk*1,Chara.HurtType.PHY,Chara.AtkType.SKILL)
			cha.addBuff(bf.yaoguang.new())
		aiCha.addBuff(bf.yaoguang.new())
	if id == "sgj":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("闪光甲", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		addBuff(shanguang.new(6))
	if id == "gy":
		var buff:Buff = aiCha.hasBuff("yaoguang")
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("光影", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		typeHurtCha(aiCha,att.atk*1.8,Chara.HurtType.PHY,Chara.AtkType.SKILL,"暗")
		aiCha.addBuff(gy.new(5))
		if buff !=null:
			typeHurtCha(aiCha,att.atk*0.5,Chara.HurtType.REAL,Chara.AtkType.EFF)
			buff.isDel = true
			aiCha.addBuff(gy1.new(5))
	if id == "tyhz":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("太阳黑子", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		var chas = getAllChas(1)
		for i in chas:
			var buff:Buff = i.hasBuff("yaoguang")
			typeHurtCha(i,att.atk*2.4,Chara.HurtType.PHY,Chara.AtkType.SKILL)
			if buff !=null:
				buff.isDel = true
				typeHurtCha(buff.masCha,att.atk*0.5,Chara.HurtType.REAL,Chara.AtkType.EFF)
			i.addBuff(bf.yaoguang.new())
			

func _onHurt(atkInfo):
	._onHurt(atkInfo)
	var buff = hasBuff("shanguang")
	if buff != null:
		atkInfo.atkCha.addBuff(bf.yaoguang.new())


class shanguang:
	extends Buff
	var dispelable = true
	func _init(lv = 1):
		attInit()
		life = lv
		id = "shanguang"
		att.atkR += 0.2
		att.dod += 0.5
	func _connect():
		masCha.connect("onHurt",self,"_onHurt")
	func _onHurt(atkInfo:AtkInfo):
		if Chara.AtkType.SKILL && sys.rndPer(50):
			atkInfo.isMiss == true

class gy:
	extends Buff
	func _init(lv = 1):
		attInit()
		isNegetive=true
		var dispelable = false
		life = lv
		id = "gy"	
		att.atkL -= 0.2

class gy1:
	extends Buff
	func _init(lv = 1):
		attInit()
		isNegetive=true
		var dispelable = false
		life = lv
		id = "gy1"	
		att.defL -= 0.2
